package net.seehealth.healthpad.ui;

import net.seehealth.healthpad.R;
import net.seehealth.healthpad.application.adapter.GridViewAdapter;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

public abstract class GridViewActivity extends BaseActivity {
	
	/** 九宫格适配器 **/
	protected GridViewAdapter mGridViewAdapter;
	
	/** 九宫格视图 **/
	protected GridView mGridView;
	
	/** 侧边栏视图 **/
	protected RelativeLayout mSideBar;
	
	/** 侧边栏标题**/
	protected TextView mTitle;
	
	/** 返回按钮 **/
	private ImageButton mBackButton;
	
	/** 主页按钮 **/
//	private ImageButton mHomeButton;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initView();
		initData();
	}

	/**
	 * 初始化界面
	 */
	private void initView() {
		setContentView(R.layout.grid_view);
		mGridView = (GridView)findViewById(R.id.gv_gridview_gridview);
		mSideBar = (RelativeLayout)findViewById(R.id.rl_gridview_sidebar);
//		mSideBar.getBackground().setAlpha(15);
		mTitle = (TextView) findViewById(R.id.tv_gridview_title);
		mBackButton = (ImageButton) findViewById(R.id.btn_gridview_back);
		mBackButton.setOnClickListener(listener);
//		mHomeButton = (ImageButton) findViewById(R.id.btn_gridview_home);
		
	}
	
	/**
	 * 初始化数据
	 */
	protected abstract void initData(); 
	
	OnClickListener listener = new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			if(v == mBackButton){
				finish();
			}
		}
	};

}
